var province_id=null;
$(function(){
	for (var i = 0; i < citys.length; i++) {
		$('#province').append("<option>"+citys[i]['name']+"</option>");
	}


	$('#province').change(function(){
		var province_index=$(this).children('option:selected').index();
		province_id=province_index-1;
		var cityArr=citys[province_index-1]['city'];
		for(var i=0 ;i<cityArr.length; i++){
			$('#city').append("<option>"+cityArr[i]['name']+"</option>");
		}

	})


	$('#city').change(function(){
		var city_html=$(this).children('option:selected').html();
		var cityArr=citys[province_id]['city'];
		for(var i=0 ;i<cityArr.length;i++){
			if(city_html===cityArr[i]['name']){
				var countryArr=cityArr[i]['area'];
				for(var j=0; j<countryArr.length; j++){
					$('#country').append("<option>"+countryArr[j]+"</option>")
				}
			}
		}
	})


})